package com.bdqn.controller;

import com.bdqn.pojo.StockProducter;
import com.bdqn.service.StockProducterService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("sp")
public class StockProducterController {
    @Autowired
    StockProducterService stockProducterService;
    @GetMapping("page")
        public PageInfo<StockProducter> page(int pageNum, int pageSize, String producterName, String keywords, String producterTel, String status, String createTime){
        PageInfo<StockProducter> pageInfo=stockProducterService.page(pageNum,pageSize,producterName,keywords,producterTel,status,createTime);
        return pageInfo;
    }
    @PostMapping("update")
    public int update(@RequestBody StockProducter formm){
        int r=stockProducterService.update(formm);
        return r;
    }
    @PostMapping("insert")
    public int insert(@RequestBody StockProducter formm){
        int r=stockProducterService.insert(formm);
        return r;
    }
    @GetMapping("all")
    public List<StockProducter> All(String producterName,String keywords,String producterTel,String status,String createTime){
        List<StockProducter> list=stockProducterService.All(producterName,keywords,producterTel,status,createTime);
        return list;
    }
}
